Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for configuring PoE for cisco equipment #2635

Merged
merged 25 commits into from
Nov 15, 2023

Conversation

stveit
Copy link
Contributor

@stveit stveit commented May 31, 2023

Fixes #2632.

Adds backend for getting current PoE state for interfaces and changing the state.

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Attention: 10 lines in your changes are missing coverage. Please review.

Comparison is base (bb794f2) 55.43% compared to head (4a8d71d) 55.46%.

Files Patch % Lines
python/nav/portadmin/snmp/cisco.py 81.48% 10 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2635      +/-   ##
==========================================
+ Coverage   55.43%   55.46%   +0.03%     
==========================================
  Files         567      567              
  Lines       41120    41175      +55     
==========================================
+ Hits        22793    22838      +45     
- Misses      18327    18337      +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

github-actions bot commented May 31, 2023

Test results

     12 files       12 suites   11m 46s ⏱️
3 256 tests 3 256 ✔️ 0 💤 0
9 243 runs  9 243 ✔️ 0 💤 0

Results for commit 4a8d71d.

♻️ This comment has been updated with latest results.

@stveit stveit force-pushed the poe-cisco branch 2 times, most recently from c3fff35 to 361dfa5 Compare May 31, 2023 12:33
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you have something to throw at Volda here :) But again, they might still not want to use PortAdmin, so asking for test candidates from the whole nav-ref group might be preferable.

@sonarcloud
Copy link

sonarcloud bot commented Jul 12, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@sonarcloud
Copy link

sonarcloud bot commented Aug 30, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly top notch to me, but see inline comments :)

python/nav/portadmin/snmp/cisco.py Outdated Show resolved Hide resolved
python/nav/portadmin/snmp/cisco.py Outdated Show resolved Hide resolved
python/nav/portadmin/snmp/cisco.py Outdated Show resolved Hide resolved
Comment on lines 370 to 378
:returns: A dict mapping interfaces to their discovered PoE state.
The key matches the `ifindex` attribute for the related
Interface object.
The value will be None if the interface does not support PoE.
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I approved the base updates to the ManagementHandler API, but now I'm wondering if using ifindexes in response values was such a good idea. The only other ManagementHandler methods that return a dict mapping for interfaces uses the interface names as the key, not their SNMP ifindex, which may be meaningless if the protocol handler isn't talking SNMP (like the Juniper handler, which speaks NETCONF-ish)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Interface.ifname should be used instead?

Copy link
Contributor Author

@stveit stveit Nov 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also have some apprehensions for how the interfaces argument is handled.

Is this part really necessary:

If this (interfaces) parameter is omitted,
the default behavior is to filter on all Interface objects
registered for this device.

If the caller of the function wants to get poe state for all interfaces, then they can just put that in the interfaces argument directly. This extra functionality adds needless complexity imo

Basically I am saying that maybe it shouldn't be optional at all

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the caller of the function wants to get poe state for all interfaces, then they can just put that in the interfaces argument directly. This extra functionality adds needless complexity imo

Removing it will just move the complexity to the caller instead.

However, we should keep the design as it is in this PR, to remain consistent, and let's have this discussion in a new issue instead.

python/nav/portadmin/snmp/cisco.py Outdated Show resolved Hide resolved
Copy link
Member

@lunkwill42 lunkwill42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK to me - looking forward to a test on real equipment :)

these dont have to be accessed in any way in the test,
so its cleaner to activate them through the decorator than
as an argument
Copy link

sonarcloud bot commented Nov 15, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@stveit stveit merged commit 57cca67 into Uninett:master Nov 15, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Configure PoE for Cisco equipment
2 participants